/**
 * User: c3t
 * Date: 13-12-7
 * Time: 上午9:38
 */
/**
 * User: c3t
 * Date: 13-11-14
 * Time: 下午2:30
 */
define(function (require, exports, module) {


    var obj = require('lib/XmlHttpRequest');
    var $= require('lib/jquery');
    $(function() {
        alert($().jquery);
    });

    /*window.onload = init;
    function init() {
        var $= require('lib/jquery');

       // var btn = document.getElementById("did");
        //btn.onchange = getData;
    }*/

    function getData() {

        var did = this.value;
        var xhr = obj.getXHR;

        xhr.open("post", "../personJson.do", true);
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status == 200) {
                var jsonText = xhr.responseText;
               var persons = eval(jsonText);
                var node = "";
                for (var i = 0; i < persons.length; i++) {
                    node += persons[i].name+"------"
                            +persons[i].age+"-------"
                            +persons[i].salary+"<br />"
                }
                document.getElementById("persons").innerHTML=node;

            }
        }
        xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xhr.send("did=" + did);
    }
});